package com.unity3d.lessonapp3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        TextView txtView2=findViewById(R.id.textView1);
        String schoolName=getIntent().getStringExtra("name");
        txtView2.setText(schoolName);


        Student student=(Student)getIntent().getSerializableExtra("student");
        StringBuffer sbf=new StringBuffer();
        sbf.append(student.id);
        sbf.append(student.age);
        sbf.append(student.name);
        txtView2.setText(sbf);


        findViewById(R.id.imageView).setOnClickListener(
                (view)->{
                    finish();
                    Intent intent =new Intent(MainActivity2.this,MainActivity.class);
                    startActivity(intent);
                }
        );
    }
}